package {base_package}.controller;

import {base_package}.entity.{cap_table_name};
import {base_package}.service.{cap_table_name}Service;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/{cap_table_name}")
public class {cap_table_name}Controller _{_
	private static Logger log = Logger.getLogger({cap_table_name}Controller.class);
	@Autowired
	private {cap_table_name}Service {low_table_name}Service;

    @RequestMapping("/select")
	public void select() _{_
		{cap_table_name} {low_table_name} = new {cap_table_name}();
		List<{cap_table_name}> a = {low_table_name}Service.select{cap_table_name}({low_table_name});
	_}_

	@RequestMapping("/insertPage")
	public String insertPage() _{_
		return "insert{cap_table_name}";
	_}_

	@RequestMapping(value = "/doInsert", method = RequestMethod.POST)
	public void doInsert(HttpServletRequest request) _{_
		{low_table_name}Service.insert{cap_table_name}(get{cap_table_name}(request));
	_}_

	@RequestMapping("/delete")
	public void delete{cap_table_name}(HttpServletRequest request) _{_
		Map<String, Object> param = new HashMap<>();
		param.put("{low_table_name}Id", request.getParameter("{low_table_name}Id"));
		{low_table_name}Service.delete{cap_table_name}(param);
	_}_

	@RequestMapping("/updatePage")
	public String updatePage() _{_
		return "update{cap_table_name}";
	_}_

	@RequestMapping(value = "/doUpdate", method = RequestMethod.POST)
	public void doUpdate{cap_table_name}(HttpServletRequest request) _{_
		{cap_table_name} {low_table_name} = get{cap_table_name}(request);
		{low_table_name}.setId(1);
		System.out.println({low_table_name}.toString());
		{low_table_name}Service.update{cap_table_name}({low_table_name});
	_}_

	public {cap_table_name} get{cap_table_name}(HttpServletRequest request) _{_
		{cap_table_name} {low_table_name} = new {cap_table_name}();
		{req_code}
		return {low_table_name};
	_}_
_}_
